Platform Explorer / Nuxeo Platform 2023.19

Extension point processors

Documentation

The processors extension point allows to define what processors should apply to resources. Some builtin processors apply to all resources, implicitly, this is the case for all processors coming with wro4j.

Other processors require the resource to reference them explicitly in the resource definition (like the "flavor" Nuxeo-specific processor).

Example:

    <processor name="myProc" order="10" type="wroPost">
        <class>org.nuxeo.ecm.web.resources.tests.MockProcessor</class>
    </processor>

The processor type is a marker that allows to group and order processors for a given usage (here, as a wro4j post processor).

Multiple types are also supported:

    <processor name="myProc" order="10">
        <types>
            <type>wropPre</type>
            <type>wropPost</type>
        </types>
        <class>org.nuxeo.ecm.web.resources.tests.MockProcessor</class>
    </processor>

The processor class usually needs to follow a given interface depending on its type, but this check is only done at runtime. For instance, processors with the "wroPre" type have to extend ro.isdc.wro.model.resource.processor.ResourcePreProcessor and processors with the "wroPost" type have to extend ro.isdc.wro.model.resource.processor.ResourcePostProcessor.

Builtin wro processors can also be registered without mentioning a class, using their wro alias:

    <processor name="cssMin" order="30" type="wroPre"/>

Some default processors (like cssMin above) are already registered by default in Nuxeo.

Contribution Descriptors

  • Class: org.nuxeo.ecm.web.resources.core.ProcessorDescriptor

Existing Contributions

Contributions are presented in the same order as the registration order on this extension point. This order is displayed before the contribution name, in brackets.

  • nuxeo-web-resources-wro-2023.19.6.jar /OSGI-INF/webresources-contrib.xml
    <extension point="processors" target="org.nuxeo.ecm.platform.WebResources">
    
        <processor name="nuxeoCssUrlRewriting" order="10" type="wroPre">
          <class>
            org.nuxeo.ecm.web.resources.wro.processor.CssUrlRewritingProcessor
          </class>
        </processor>
        <processor name="cssMinJawr" order="30" type="wroPre"/>
    
        <processor name="jsMin" order="10" type="wroPost">
          <class>ro.isdc.wro.model.resource.processor.impl.js.JSMinProcessor</class>
        </processor>
    
        <processor name="flavor" type="wroPre">
          <class>
            org.nuxeo.ecm.web.resources.wro.processor.FlavorResourceProcessor
          </class>
        </processor>
    
        <processor name="sassCss" type="wroPre">
          <class>
            org.nuxeo.ecm.web.resources.wro.processor.SassCssFlavorProcessor
          </class>
        </processor>
    
      </extension>